<template>
  <div class="mr">
    <header>
      <p class="header_name">
        {{ item.GWName ? item.GWName : "" }}
      </p>
      <span>{{ transitionTime(item.UpdateTime) }}</span>
      <p class="header_type header_type_a">A面</p>
      <p class="header_type header_type_b">B面</p>
      <ul>
        <li>
          <p>
            <span>通讯</span>
            <span class="icon icon1" v-if="item.CommAlarm === 0"></span>
            <span class="icon icon2" v-else></span>
          </p>
          <p>
            <span>翻卡</span>
            <!--   -->
            <span class="icon icon2" v-if="item.FanKaAlarm === 1"></span>
            <span class="icon icon3" v-else></span>
          </p>
        </li>
        <li>
          <span class="w">总数</span>/ <span class="g">正常</span>/
          <span class="r">告警</span>: <span class="w">{{ item.TotalCnt }}</span
          >/ <span class="g">{{ item.NormalCnt }}</span
          >/
          <span class="r">{{ item.AlarmCnt }}</span>
        </li>
      </ul>
    </header>
    <main>
      <ul class="main_left">
        <li v-for="items in 5" :key="items">
          <div class="main_right_li" v-for="i in 5" :key="i">
            <template v-if="item.AInstrs[items * 5 + i - 6]">
              <a-popover title="详情" placement="topLeft">
                <template #content>
                 
                  <p>
                    仪表条形码:{{ item.AInstrs[items * 5 + i - 6].InstrCode }}
                  </p>
                  <p>产品编码:{{ item.AInstrs[items * 5 + i - 6].FacNo }}</p>
                  <p>
                    产品老化:{{
                      item.AInstrs[items * 5 + i - 6].InstrCode
                        ? item.AInstrs[items * 5 + i - 6].HasAgeTime
                        : "-"
                    }}/{{
                      item.AInstrs[items * 5 + i - 6].InstrCode
                        ? item.AInstrs[items * 5 + i - 6].NeedAgeTime
                        : "-"
                    }}(分钟)
                  </p>
                  <p>故障:{{ item.AInstrs[items * 5 + i - 6].StatusDesp }}</p>
                  <p>
                    仪表更新时间:{{
                      transitionTime(item.AInstrs[items * 5 + i - 6].InstrUpdateTime)
                    }}
                  </p>
                  <p>
                    仪表数据:{{ item.AInstrs[items * 5 + i - 6].InstrValue }}
                  </p>
                  <p>
                    采集卡更新时间:{{
                      transitionTime(item.AInstrs[items * 5 + i - 6].UpdateTime)
                    }}
                  </p>
                  <p>
                    采集通道数据:{{ item.AInstrs[items * 5 + i - 6].CCValue }}
                  </p>
                  <p>
                    采集通道:{{ item.AInstrs[items * 5 + i - 6].CCCName }}
                  </p>
                </template>
                <div
                  :class="[
                    {
                      green: item.AInstrs[items * 5 + i - 6].Color == 0,
                    },
                    {
                      yellow: item.AInstrs[items * 5 + i - 6].Color == 1,
                    },
                    {
                      blue: item.AInstrs[items * 5 + i - 6].Color == 2,
                    },
                    {
                      white: item.AInstrs[items * 5 + i - 6].Color == 3,
                    },
                    {
                      gray: item.AInstrs[items * 5 + i - 6].Color == 4,
                    },
                    {
                      red: item.AInstrs[items * 5 + i - 6].Color == 5,
                    },
                   
                  ]"
                >
                  <p>{{ items * 5 + i - 5 }}</p>
                  <span></span>
                </div>
              </a-popover>
            </template>
          </div>
        </li>
      </ul>
      <a-divider
        type="vertical"
        style="height: 95%; background-color: #224c5b"
        dashed
      />
      <ul class="main_right">
        <li v-for="items in 5" :key="items">
          <div class="main_right_li" v-for="i in 5" :key="i">
            <template v-if="item.BInstrs[items * 5 + i - 6]">
              <a-popover title="详情">
                <template #content>
                 
                  <p>
                    仪表条形码:{{ item.BInstrs[items * 5 + i - 6].InstrCode }}
                  </p>
                  <p>产品编码:{{ item.BInstrs[items * 5 + i - 6].FacNo }}</p>
                  <p>
                    产品老化::{{
                      item.BInstrs[items * 5 + i - 6].FacNo
                        ? item.BInstrs[items * 5 + i - 6].HasAgeTime
                        : "-"
                    }}/{{
                      item.BInstrs[items * 5 + i - 6].FacNo
                        ? item.BInstrs[items * 5 + i - 6].NeedAgeTime
                        : "-"
                    }}(分钟)
                  </p>
                  <p>故障:{{ item.BInstrs[items * 5 + i - 6].StatusDesp }}</p>
                  <p>
                    仪表更新时间:{{
                      transitionTime(item.BInstrs[items * 5 + i - 6].InstrUpdateTime)
                    }}
                  </p>
                  <p>
                    仪表数据:{{ item.BInstrs[items * 5 + i - 6].InstrValue }}
                  </p>
                  <p>
                    采集卡更新时间:{{
                      transitionTime(item.BInstrs[items * 5 + i - 6].UpdateTime)
                    }}
                  </p>
                  <p>
                    采集通道数据:{{ item.BInstrs[items * 5 + i - 6].CCValue }}
                  </p>
                  <p>
                    采集通道:{{ item.BInstrs[items * 5 + i - 6].CCCName }}
                  </p>
                </template>
                <div
                :class="[
                    {
                      green: item.BInstrs[items * 5 + i - 6].Color == 0,
                    },
                    {
                      yellow: item.BInstrs[items * 5 + i - 6].Color == 1,
                    },
                    {
                      blue: item.BInstrs[items * 5 + i - 6].Color == 2,
                    },
                    {
                      white: item.BInstrs[items * 5 + i - 6].Color == 3,
                    },
                    {
                      gray: item.BInstrs[items * 5 + i - 6].Color == 4,
                    },
                    {
                      red: item.BInstrs[items * 5 + i - 6].Color == 5,
                    },
                   
                  ]"
                >
                  <p>{{ items * 5 + i + 20 }}</p>
                  <span></span>
                </div>
              </a-popover>
            </template>
          </div>
        </li>
      </ul>
    </main>
  </div>
</template>

<script setup>
import { transitionTime } from "@/utils/time.js";
import { onMounted } from "vue";

const props = defineProps({
  item: {
    type: Object,
    default: () => {
      return {};
    },
  },
});
onMounted(() => {});
</script>

<style lang="scss" scoped>
.mr {
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  background-image: url("@/static/supervisoryControl/pic_bj12.png");
  overflow: hidden;
  font-size: 1em;
  position: relative;
  overflow: hidden;
  container-type: size !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;

  & > * {
    width: 100%;
  }
  header {
    top: 0.5%;
    height: 12%;
    //background-color: rgba(104, 54, 54, 0.527);
    position: absolute;
    z-index: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    * > * {
      z-index: 1;
      white-space: nowrap;
    }
    & > p {
      font-family: PingFangSC, PingFang SC;
      font-weight: 600;
      font-size: calc((2.4cqh) + (1.2cqw));
      color: #fefefe;
    }
    & > .header_name {
      position: absolute;
      left: 1.6%;
    }
    & > span {
      font-family: PingFangSC, PingFang SC;
      font-weight: 600;
      font-size: calc((1.4cqh) + (0.8cqw));
      color: #00e5ff;
      position: absolute;
      left: 18.8%;
      top: 47%;
    }
    & > .header_type {
      position: absolute;
      top: 40%;
      font-size: calc((1.5cqh) + (0.8cqw));
    }
    & > .header_type_a {
      left: 41.8%;
      background-image: url("@/static/supervisoryControl/pic_bj13.png");
      background-repeat: no-repeat;
      background-size: 100% 100%;
      padding: calc((0.4cqh) + (0.2cqw)) calc((0.8cqh) + (0.4cqw));
    }
    & > .header_type_b {
      left: 54%;
      background-image: url("@/static/supervisoryControl/pic_bj14.png");
      background-repeat: no-repeat;
      background-size: 100% 100%;
      padding: calc((0.4cqh) + (0.2cqw)) calc((0.8cqh) + (0.4cqw));
    }
    & > ul {
      position: absolute;
      right: 2%;

      height: 100%;
      display: flex;
      flex-direction: row-reverse;
      justify-content: center;
      align-items: center;
      & > :first-child {
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        color: #ffffff;
      }
      & > li {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        font-family: PingFangSC, PingFang SC;
        margin-top: 1%;
        color: #ffffff;
        & > p {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-left: 1cqw;
        }
        span {
          font-size: calc((2.2cqh) + (1.1cqw));

          font-family: PingFangSC, PingFang SC;
          font-weight: 600;
          color: #ffffff;
        }
        .icon {
          margin-left: 0.2cqw;
          width: calc((2.2cqh) + (1.1cqw));
          height: calc((2.2cqh) + (1.1cqw));
          border-radius: 100%;
        }
        .icon1 {
          background-color: #22a972;
          box-shadow: 0 0 20px 0 #ffffff;
        }
        @keyframes identifier {
          0% {
            background-color: #11354D;
          }
          100% {
            background-color: #ff0000;
            
          }
        }
        .icon2 {
        /*   background-color: #ff0000;
          box-shadow: 0 0 20px 0 #fbfbfb; */
          animation:  identifier .4s linear infinite;

        }
        .icon3 {
          background-color: #878585;
          box-shadow: 0 0 20px 0 #ffffff;
        }
      }
      & > :last-child {
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: calc((1.5cqh) + (0.8cqw));
        color: #ffffff;
        margin-top: 4%;
        margin-right: 1%;
        & > span {
          font-size: calc((1.5cqh) + (0.8cqw));
        }
        .w {
          color: #fff;
        }
        .g {
          color: #22a972;
        }
        .r {
          color: #cd2121;
        }
      }
    }
  }
  main {
    position: absolute;
    z-index: 1;
    top: 12%;
    height: 84%;
    //background-color: rgba(59, 59, 148, 0.523);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2.6%;
    & > ul {
      background-color: #0a202f;
      width: 47.3%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
      & > li {
        width: 100%;
        flex: 1;
        background: url("@/static/supervisoryControl/pic_bj10.png");
        background-repeat: no-repeat;
        background-size: 212% 540%;
        background-position: 3% 14%;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding-bottom: 2.7%;
        & .main_right_li {
          & > div {
            border-radius: 100%;
            box-sizing: content-box;
            width: calc((4cqh) + (2cqw));
            height: calc((4cqh) + (2cqw));
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;

            & > p {
              font-family: PingFangSC, PingFang SC;
              font-weight: 600;
              font-size: calc((2cqh) + (1cqw));
              color: #ffffff;
            }
            & > span {
              position: absolute;
              border-radius: 100%;
              //border: 1px dashed #fff;
              width: 130%;
              height: 130%;
              top: 50%;
              left: 50%;
              transform: translateX(-50%) translateY(-50%);
            }
          }
          .gray {
            background-color: #878585;
            /*  box-shadow: 0 0 0 calc((1.1cqh) + (0.5cqw)) #374d5a,
              0 0 0 calc((1.5cqh) + (0.8cqw)) #374d5a63; */
            box-shadow: 0 0 0 calc((0.5cqh) + (0.25cqw)) #374d5a,
              0 0 0 calc((1cqh) + (0.5cqw)) #374d5a63;
          }
          .green {
            background-color: #22a972;
            box-shadow: 0 0 0 calc((0.5cqh) + (0.25cqw)) #125650,
              0 0 0 calc((1cqh) + (0.5cqw)) #12565063;
          }
          .yellow {
            background-color: #ff8300;
            box-shadow: 0 0 0 calc((0.5cqh) + (0.25cqw)) #784815,
              0 0 0 calc((1cqh) + (0.5cqw)) #78481563;
          }
          .red {
            background-color: #cd2121;
            box-shadow: 0 0 0 calc((0.5cqh) + (0.25cqw)) #502835,
              0 0 0 calc((1cqh) + (0.5cqw)) #50283583;
            // animation: ripple_3 5s linear infinite;
          }
          .blue{
            background-color: #2f4ac2;
            box-shadow: 0 0 0 calc((0.5cqh) + (0.25cqw)) #384892,
              0 0 0 calc((1cqh) + (0.5cqw)) #38489263;
          }
          .white {
            background-color: white;
            box-shadow: 0 0 0 calc((0.5cqh) + (0.25cqw)) #c6c6c6,
              0 0 0 calc((1cqh) + (0.5cqw)) #d5d5d563;
            & > p {
              color: #333;
            }
          }
        }
      }
    }
  }
}
</style>